package com.ky.tms.controller;


import com.ky.tms.service.IOssService;
import com.ky.tms.util.CommonResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

@Api(value = "文件存储", tags = "文件存储")
@RestController
@RequestMapping("oss")
public class OssController {

    @Autowired
    private IOssService iOssService;

    @PostMapping("uploadImg")
    @ApiOperation(value = "上传图片", notes = "上传图片")
    public CommonResult<String> uploadImg(@RequestParam("file") MultipartFile file) throws Exception {
        String s = iOssService.uploadImg(file);
        return CommonResult.buildSuccess(s);
    }
}
